CREATE TABLE `${demo.simplename}sensor` (
   `id` bigint NOT NULL AUTO_INCREMENT COMMENT '${demo.simplename}传感器的编号。主键。自动递增。',
   `stationid` int DEFAULT NULL COMMENT '外键。变电站的编号。',
   `devicegroup` int DEFAULT NULL COMMENT '设备组',
   `deviceaddr` int DEFAULT NULL COMMENT '设备地址。传感器的站号。',
   `lastdatatime` datetime DEFAULT NULL,
   `lasthisdatatime` datetime DEFAULT NULL,
   `pointname` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '监测点的名称。',
   <#list demo.yaoce as yaoce>
    `last${yaoce.name}` float(11,2) DEFAULT 0 COMMENT '${yaoce.comment}',
   </#list>
   <#list demo.yaoxin as yaoxin>
    `last${yaoxin.name}` int DEFAULT '0' COMMENT '${yaoxin.comment}',
   </#list>
   `memo` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '判断数据是否变化的标志，通过对比上次拼接数据字符串来判断是否变化',
   `style` varchar(2000) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT '<#list demo.yaoce as yaoce>${yaoce.name}|1|${yaoce.comment},</#list><#list demo.yaoxin as yaoxin>${yaoxin.name}|1|${yaoxin.comment}<#if yaoxin?has_next>,</#if></#list>' COMMENT '前端显示哪些字段',
   `inuse` int DEFAULT '1' COMMENT '该监测点是否要用到',
   `lastalarmlevel` int DEFAULT '0' COMMENT '报警等级。最新一条数据。\\\\\\\\\\\\\\\\n0=正常，1=预警(黄色)，2=报警(红色)',
   `lastalarmmessage` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '上次报警消息。',
   `lastcommunicationstatus` int DEFAULT '1' COMMENT '通信状态。 0表示正常，1表示异常。不论通信成功或者失败，都必须修改此值。',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


 -- ---------------------------------------------------------------------------------------------------------


 CREATE TABLE `${demo.simplename}history` (
   `id` bigint NOT NULL AUTO_INCREMENT COMMENT '${demo.simplename}传感器的编号。主键。自动递增。',
   `stationid` int DEFAULT NULL COMMENT '外键。变电站的编号。',
   `devicegroup` int DEFAULT NULL COMMENT '设备组',
   `deviceaddr` int DEFAULT NULL COMMENT '设备地址。传感器的站号。',
   `datatime` datetime DEFAULT NULL,
   `pointname` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '监测点的名称。',
   <#list demo.yaoce as yaoce>
    `${yaoce.name}` float(11,2) DEFAULT 0 COMMENT '${yaoce.comment}',
   </#list>
   <#list demo.yaoxin as yaoxin>
    `${yaoxin.name}` int DEFAULT '0' COMMENT '${yaoxin.comment}',
   </#list>
   `memo` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '判断数据是否变化的标志，通过对比上次拼接数据字符串来判断是否变化',
   `style` varchar(2000) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '前端显示哪些字段',
   `inuse` int DEFAULT '1' COMMENT '该监测点是否要用到',
   `alarmlevel` int DEFAULT '0' COMMENT '报警等级。最新一条数据。\\\\\\\\\\\\\\\\n0=正常，1=预警(黄色)，2=报警(红色)',
   `alarmmessage` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '上次报警消息。',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

